﻿using System.Collections.Generic;
using System.Diagnostics.Contracts;

namespace CodePlex.Diagnostics.Contracts.Conditions
{
	public static partial class Condition
	{
    [Pure]
    public static bool IsEmpty<T>(this ICollection<T> collection)
		{
			Contract.Requires(!collection.IsNull());
      Contract.Ensures(Contract.Result<bool>() == (collection.Count == 0));

			return collection.Count == 0;
		}

    [Pure]
    public static bool IsNullOrEmpty<T>(this ICollection<T> collection)
    {
      Contract.Ensures(Contract.Result<bool>() == (collection.IsNull() || collection.IsEmpty()));

      return collection.IsNull() || collection.IsEmpty();
    }
  }
}
